<! Controller -->
<?php
	require_once ('../../models/ProductCategory.php');
	
	if(isset($_POST['id']))
	{
		$row = $_POST;
		$response=ProductCategory::Delete($row);
		if($response === true)
        	header("Location: index.php");
	}
	else 
	{
		$row = ProductCategory::Get($_REQUEST['id']);
	}
	
?>

<! View -->
<!DOCTYPE html>
<html lang="en">
	<?php include('../../inc/head.php'); ?>
	<body>
		<div>
			<?php include('../../inc/nav.php') ?>
		</div>
		<div id="content" class="dl-horizontal">
			
			<div class="control-group">
				<? function RenderInput($propertyName) { ?>
					<? global $row ?>
					<dl>
						<dt><?=$propertyName?>:</dt>
						<dd><?=$row[$propertyName]?></dd>
					</dl>
				<? } ?>
				
				<? 
				RenderInput('created_at');
				RenderInput('updated_at');
				RenderInput('Name');
				
				?>
				
				<div class="controls">
					<form class="form-horizontal" action="" method="post">
						<input type="hidden" name="id" value="<?=$row['id']?>" />
						<input type="submit" value="Delete" class="btn btn-primary">
					</form>
				</div>
			</div>
		</div>
			
		</div>
			<?php include('../../inc/footer.php'); ?>
		</div>
	</body>
</html>
